package LeetCode.month03.day76;

/**
 * @author 16778
 * @date 2025/10/16 9:47
 * @description
 */
public class No2598 {
    static void main() {
        System.out.println(-10%3);
    }
    public int findSmallestInteger(int[] nums, int value) {
        int n = nums.length;
        int[] mp = new int[value];
        for (int i = 0; i < n; i++) {
            if(nums[i]<0){
                nums[i]=nums[i]%value+value;
            }
            nums[i]%=value;
            mp[nums[i]]++;
        }
        int min = mp[0];
        int num = 0;
        for (int i = 1; i < nums.length; i++) {
            if(nums[i]<min){
                min = nums[i];
                num = i;
            }
        }
        return min*value+num;
    }
}
